const { ccclass, property } = cc._decorator;

@ccclass
export default class ProgressBar extends cc.Component {
    @property(cc.Label)
    text: cc.Label = null;
    @property(cc.Label)
    scale: cc.Label = null;
    @property(cc.ProgressBar)
    bar: cc.ProgressBar = null;
    @property(cc.String)
    Text: string = "正在加载...";
    onLoad() {
        this.text.string = this.Text;
        this.scale.string = "0%";
        this.bar.progress = 0;
    }
    setScale(scale: number) {
        if (scale > 1)
            scale = 1;
        this.bar.progress = scale;
        this.scale.string = Math.floor((scale * 100)) + "%";
    }
}
